
<script>
export default {
    name: 'goods-list',
    props: ['data'],
    render(h, context) {
        return (
            <div class="goods-list">
                <i-table border data={this.data} columns={this.columns} />
            </div>
        )
    },
    data() {
        return {
            test: 'test',
            columns: [
                {
                    type: 'selection',
                    width: 55,
                    align: 'center'
                },
                {
                    title: '商品名',
                    width: '40%',
                    key: 'productName'
                },
                {
                    title: '价格',
                    key: 'price',
                    sortable: true
                },
                {
                    title: '库存',
                    key: 'inventory',
                    sortable: true,
                    render: (h, params) => {
                        return (
                            <div>
                                <span>
                                    {params.row.inventory}
                                    <i-icon
                                        type="edit"
                                        style="margin-left: 6px; color: #aaa"
                                    />
                                </span>
                            </div>
                        )
                    }
                },
                {
                    title: '销量',
                    key: 'sales'
                },
                {
                    title: '发布时间',
                    key: 'releaseTime'
                },
                {
                    title: '管理',
                    key: 'management',
                    align: 'center',
                    render: (h, params) => {
                        return (
                            <div>
                                <i-button size="small" type="error">
                                    <i-icon type="trash-a" size={14} />
                                </i-button>
                            </div>
                        )
                    }
                }
            ]
        }
    }
}
</script>
<style lang="less" scoped>
@import '~@/assets/style/theme/index';
.goods-list {
    margin-top: @gap;
}
.footer {
    display: flex;
    justify-content: space-between;
    margin-top: @gap;
}
.footer-left button {
    margin-right: 4px;
}
</style>